package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CourseBaseDTO;
import com.xuecheng.api.content.model.vo.CourseBaseVo;
import com.xuecheng.content.entity.CourseBase;
import com.xuecheng.content.entity.CoursePub;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Created on 2021/03/28/14:33 周日
 * 课程基本信息PO到DTO转换接口
 *
 * @author Lantin
 */

@Mapper
public interface CourseBaseConvert {

    CourseBaseConvert INSTANCE = Mappers.getMapper(CourseBaseConvert.class);

    @Mapping(source = "id", target = "courseBaseId")
    CourseBaseDTO courseBaseToDto(CourseBase courseBase);

    @Mapping(source = "courseBaseId", target = "id")
    CourseBase dtoToCourseBase(CourseBaseDTO courseBaseDTO);

    CourseBaseDTO courseBaseVoToDto(CourseBaseVo courseBaseVo);

    List<CourseBaseDTO> courseBaseToDtoList(List<CourseBase> courseBase);

    @Mapping(source = "id",target = "courseId")
    CoursePub courseBaseToCoursePub(CourseBase courseBase);
}
